
<div class="col-md-12 mb-s clearfix">
    <div class="pull-left">
        <h4>Observable List ({{artifacts.total || 0}} of {{artifactStats.count}})</h4>
    </div>
    <div class="active-filters">
        <ul class="" ng-if="uiSrv.countFilters() > 0">
            <li>{{uiSrv.countFilters()}}
                filter(s) applied:
            </li>
            <li class="filter-item" ng-repeat="(field,filter) in uiSrv.filters">
                <span>
                    <strong>{{field}}:</strong>
                    {{filter.value | filterValue}}</span>
                <a href="" ng-click="removeFilter(field)">
                    <span class="filter-close fa fa-times text-danger"></span>
                </a>
            </li>
            <li>
                <a href="" ng-click="clearFilters()">Clear filters</a>
            </li>
        </ul>
    </div>
</div>


<div class="col-md-12 mv-s" ng-show="artifacts.total === 0">
    <div class="empty-message">No records.</div>
</div>

<!-- list of artifacts-->
<div class="col-md-12" ng-show="artifacts.total > 0">
    <psearch ng-if="!switchTEList" control="artifacts"></psearch>

    <table class="table table-striped table-hover case-list">
        <thead>
            <tr>
                <th style="width: 10px;" class="p-0"></th>
                <th style="width: 20px">
                    <input type="checkbox" ng-change="selectAll()" ng-model="selection.all" ng-disabled="switchTEList"></input>
                </th>
                <th style="width: 15px"></th>
                <th style="width: 15px"></th>
                <th style="width: 15px"></th>
                <th style="width: 100px">
                  <a href class="text-default" ng-click="sortBy('dataType')">
                    Type
                    <i ng-show="artifacts.sort !== '+dataType' && artifacts.sort !== '-dataType'" class="fa fa-sort"></i>
                    <i ng-show="artifacts.sort === '+dataType'" class="fa fa-caret-up"></i>
                    <i ng-show="artifacts.sort === '-dataType'" class="fa fa-caret-down"></i>
                  </a>
                </th>
                <th>
                  <a href class="text-default" ng-click="sortBy('data')">
                    Value/Filename
                    <i ng-show="artifacts.sort !== '+data' && artifacts.sort !== '-data'" class="fa fa-sort"></i>
                    <i ng-show="artifacts.sort === '+data'" class="fa fa-caret-up"></i>
                    <i ng-show="artifacts.sort === '-data'" class="fa fa-caret-down"></i>
                  </a>
                </th>
                <th style="width: 120px">
                  <a href class="text-default" ng-click="sortBy('startDate')">
                    Date Added
                    <i ng-show="artifacts.sort !== '+startDate' && artifacts.sort !== '-startDate'" class="fa fa-sort"></i>
                    <i ng-show="artifacts.sort === '+startDate'" class="fa fa-caret-up"></i>
                    <i ng-show="artifacts.sort === '-startDate'" class="fa fa-caret-down"></i>
                  </a>
                </th>
                <th style="width: 40px;" ng-if="appConfig.connectors.cortex.enabled">Actions</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="artifact in artifacts.values">
                <td class="p-0 bg-tlp-{{artifact.tlp}} clickable" ng-click="filterByTlp(artifact.tlp)"></td>
                <td>
                    <input type="checkbox" ng-change="selectArtifact(artifact)" ng-model="selection.list[artifact.id]">
                </td>
                <td>
                    <span ng-click="addFilterValue('ioc', artifact.ioc)" ng-if="artifact.ioc" class="clickable fa fa-star" uib-tooltip="is an IOC" tooltip-popup-delay="500" tooltip-placement="bottom"></span>
                </td>
                <td>
                    <span ng-click="addFilterValue('sighted', artifact.sighted)" ng-if="artifact.sighted" class="clickable fa fa-toggle-on" uib-tooltip="has been sighted" tooltip-popup-delay="500" tooltip-placement="bottom"></span>
                </td>
                <td>
					<span uib-tooltip="{{artifact.stats.seen}} related artifact(s)" tooltip-popup-delay="500" tooltip-placement="bottom" ng-if="artifact.stats.seen > 0" class="glyphicon glyphicon-eye-open"></span>
                </td>
                <td>
                    <a href ng-click="addFilterValue('dataType', artifact.dataType)"><span ng-bind="artifact.dataType"></span></a>
                </td>
                <td class="wrap">
                    <div class="wrap clickable" ng-click="openArtifact(artifact)" uib-tooltip="{{artifact.message}}" tooltip-placement="top-left">
                        {{(artifact.data | fang) || (artifact.attachment.name | fang)}}
                    </div>
                    <div class="case-tags flexwrap mt-xxs">
                        <span class="mr-xxxs text-muted"><i class="fa fa-tags"></i></span>
                        <strong class="text-muted mr-xxxs" ng-if="!artifact.tags || artifact.tags.length === 0">None</strong>
                        <span class="label label-primary mb-xxxs mr-xxxs pointer"
                            ng-repeat="tag in artifact.tags track by $index"
                            ng-click="addFilterValue('tags', tag)">
                            {{tag}}
                        </span>
                    </div>

                    <mini-report-list observable="artifact" reports="artifact.reports" on-item-clicked="showReport(observable, analyzerId)"></mini-report-list>
                </td>
                <td>
                    <a href ng-click="addFilterValue('startDate', artifact.startDate)"><span uib-tooltip="{{artifact.startDate | showDate}}" tooltip-popup-delay="500" tooltip-placement="bottom">{{artifact.startDate | shortDate}}</span></a>
                </td>
                <td ng-if="appConfig.connectors.cortex.enabled">
                    <span class="ml-xs" uib-dropdown>
                        <a href class="text-primary noline nowrap" ng-click="getObsResponders(artifact.id, true)" uib-dropdown-toggle>
                            <i class="text-primary fa fa-cog"></i>
                        </a>
                        <ul class="dropdown-menu align-right" uib-dropdown-menu>
                          <li ng-if="obsResponders && obsResponders.length === 0">
                            <a href ng-click="getObsResponders(artifact.id, true)">
                              <strong><i class="fa fa-refresh mr-xxs"></i> No responders available</strong>
                            </a>
                          </li>
                          <li ng-repeat="responder in obsResponders">
                            <a href ng-click="runResponder(responder.id, responder.name, artifact)">
                              <strong>{{responder.name}}</strong>
                              <br>
                              <small>{{responder.description}}</small></a>
                          </li>
                        </ul>
                    </span>
                </td>
            </tr>
        </tbody>
    </table>
    <psearch ng-if="!switchTEList" control="artifacts"></psearch>
</div>
